<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	May 17, 2010
 ^
 + Project: 		WRecruit
 * File Name:	views/jobseeker/tmpl/package_buynow.php
 ^ 
 * Description: template view for package buy now
 ^ 
 * History:		NONE
 ^ 
 */
 
 defined('_JEXEC') or die('Restricted access');
 
 global $mainframe;
// $link = 'index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=myjobs&Itemid='.$this->Itemid;
  $document =& JFactory::getDocument();
   $document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);
?>
<?php if ($this->config['offline'] == '1'){ ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	<?php echo $this->config['title']; ?></td></tr>
	<tr><td height="25"></td></tr>
	<tr><td class="wrecruitmsg">
		<?php echo $this->config['offline_text']; ?>
	</td></tr>
</table>	
<?php }else{ ?>

<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	
		<?php echo $this->config['title']; ?>
	</td>
	</tr>
	<tr><td height="23"></td></tr>
	<?php if ($this->config['cur_location'] == 1) {?>
	<tr><td class="curloc">
		<?php $pb = $this->pb; 
			if ($pb == '1'){  ?> 
		<?php echo JText::_('JS_CUR_LOC'); ?> : <a href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=packages&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_PACKAGES'); ?></a> > <?php echo JText::_('JS_PACKAGE_BUY_NOW'); ?>
		<?php }elseif ($pb == '2'){ ?> 
			<?php echo JText::_('JS_CUR_LOC'); ?> : <a href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=packages&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_PACKAGES'); ?></a> > <a href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=package_details&gd=<?php echo $this->package->id; ?>&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_PACKAGE_DETAILS'); ?></a> > <?php echo JText::_('JS_PACKAGE_BUY_NOW'); ?>
		<?php } ?>	
	</td></tr>
	<?php } ?>
	<tr nowrap><td >
		<?php 
			if (sizeof($this->jobseekerlinks) != 0){
				echo '<div id="toplinks"><ul>';
				foreach($this->jobseekerlinks as $lnk)	{ ?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
					</span>
				<?php }
				echo '<ul></div>';			
			}
		?>
	</td></tr>	
	<tr><td height="3"></td></tr>
	<tr><td class="<?php echo $this->theme['heading']; ?>" align="center">
		<?php echo JText::_('JS_BUY_NOW'); ?>
	</td></tr>
	<tr><td height="3"></td></tr>
</table>


<?php
if ($this->userrole->rolefor == 2) { // job seeker


?>
<form action="index.php" method="post" name="adminForm">
	<table cellpadding="0" cellspacing="0" border="0" width="100%" >
		<?php 
		$tdclass = array($this->theme['odd'], $this->theme['even']);
		$isodd =1;
		
		if ( isset($this->package) ){
		//foreach($this->package as $package)	{ 
		$isodd = 1 - $isodd; ?>
		<tr height="20" class="<?php echo $tdclass[$isodd]; ?>" > <td colspan="5">
			<table cellpadding="0" cellspacing="1" border="0" width="100%">
				<tr><td height="3"></td></tr>
				<tr class="<?php echo $tdclass[1-$isodd]; ?>">
					<td colspan="4" height="25" align="center" class="sectionheadline"><strong><font size="2">
					<?php echo $this->package->title; ?></font>
                                            <?php
                                                   $curdate = date('Y-m-d H:i:s');
                                                    if (($this->package->discountstartdate <= $curdate) && ($this->package->discountenddate >= $curdate)){
                                                        if($this->package->discountmessage) echo $this->package->discountmessage;
                                                    }
                                            ?></strong></td>
				</tr>
				<tr>
					<td width="20%">&nbsp;<strong><?php echo JText::_('JS_RESUME_ALLOWED'); ?>	</strong></td>
					<td width="30%"><?php if($this->package->resumeallow == -1) echo JText::_('JS_UNLIMITED'); else echo $this->package->resumeallow; ?></td>
					<td width="20%">&nbsp;<strong><?php echo JText::_('JS_COVERLETTERS_ALLOWED'); ?></strong></td>
					<td width="30%"><?php if($this->package->coverlettersallow == -1) echo JText::_('JS_UNLIMITED'); else echo $this->package->coverlettersallow; ?></td>
				</tr>
				<tr>
					<td width="20%">&nbsp;<strong><?php echo JText::_('JS_JOB_SEARCH'); ?></strong></td>
					<td width="30%"><?php if($this->package->jobsearch == 1) echo JText::_('JS_YES'); else echo JText::_('JS_NO'); ?></td>
					<td width="20%">&nbsp;<strong><?php echo JText::_('JS_SAVE_JOB_SEARCH'); ?></strong></td>
					<td width="30%"><?php if($this->package->savejobsearch == 1) echo JText::_('JS_YES'); else echo JText::_('JS_NO'); ?></td>
				</tr>
				<tr>
					<td width="20%">&nbsp;<strong><?php echo JText::_('JS_FEATURED_RESUMES'); ?>	</strong></td>
					<td width="30%"><?php if($this->package->featuredresume == -1) echo JText::_('JS_UNLIMITED'); else echo $this->package->featuredresume; ?></td>
					<td width="20%">&nbsp;<strong><?php echo JText::_('JS_GOLD_RESUMES'); ?></strong></td>
					<td width="30%"><?php if($this->package->goldresume == -1) echo JText::_('JS_UNLIMITED'); else echo $this->package->goldresume; ?></td>
				</tr>
				<tr>
				
					<td width="20%">&nbsp;<strong><?php echo JText::_('JS_APPLY_JOBS'); ?></strong></td>
					<td width="30%"><?php if($this->package->applyjobs == -1) echo JText::_('JS_UNLIMITED'); else echo $this->package->applyjobs; ?></td>
					<td width="20%">&nbsp;<strong><?php echo JText::_('JS_PACKAGE_EXPIRE_IN_DAYS'); ?></strong></td>
					<td width="30%"><?php echo $this->package->packageexpireindays; ?></td>	
				</tr>				
				
				<tr><td height="5"></td></tr>
				<tr>
					<td width="20%">&nbsp;<strong><?php echo JText::_('JS_SHORT_DETAILS'); ?></strong></td>
					<td colspan="4"><?php echo $this->package->shortdetails; ?></td>				
				</tr>
				<tr><td height="5"></td></tr>
				<tr>
					<td width="20%">&nbsp;<strong><?php echo JText::_('JS_DESCRIPTION'); ?></strong></td>
                    <td colspan="4"><?php echo $this->package->description; ?></td>
                </tr>
				<tr><td height="5"></td></tr>
				<tr height="25">
                                    <td colspan="4" class="pageheadline"><strong>&nbsp;<?php echo JText::_('JS_PRICE'); ?> :
                                        <?php
                                            if ($this->package->price != 0){
                                               $curdate = date('Y-m-d H:i:s');
                                                if (($this->package->discountstartdate <= $curdate) && ($this->package->discountenddate >= $curdate)){
                                                     if($this->package->discounttype == 1){
                                                         $discountamount = ($this->package->price * $this->package->discount)/100;
                                                          $discountamount = $this->package->price - $discountamount;
                                                         echo $this->config['currency'].$discountamount.' [ '. $this->package->discount .'% '.JText::_('JS_DISCOUNT').' ]';
                                                     }else{
                                                         $discountamount = $this->package->price - $this->package->discount;
                                                         echo $this->config['currency'].$discountamount.' [ '. JText::_('JS_DISCOUNT').' : '.$this->config['currency'].$this->package->discount .' ]';
                                                     }
                                                }else echo $this->config['currency'].$this->package->price;
                                            }else{ echo JText::_('JS_FREE'); } ?>
                                        </strong></td>
				</tr>
				<tr><td height="5"></td></tr>
			</table>	
		</td></tr>
		<tr> <td colspan="5" height="1">	</td></tr>
		<?php
		//}
		}
		 ?>	
			<tr><td colspan="2" height="10"></td></tr>	  
	<tr>
		<td colspan="2" align="center">
		<input class="button" type="submit" name="submit_app" value="<?php echo JText::_('JS_BUY_NOW'); ?>" />
		</td>
	</tr>
	</table>
			
			<input type="hidden" name="task" value="savejobseekerpayment" />
			<input type="hidden" name="Itemid" id="Itemid" value="<?php echo $this->Itemid; ?>" />
			<input type="hidden" name="packageid" value="<?php if(isset($this->package)) echo $this->package->id; ?>" />
			<input type="hidden" name="option" value="<?php echo $this->option; ?>" />
			<input type="hidden" name="uid" value="<?php echo $this->uid; ?>" />
	</form>
	<?php
} else{ // not allowed job posting
echo JText::_('JS_YOU_ARE_NOT_ALLOWED_TO_VIEW');
}	
}//ol
?>	
<div width="100%">
<?php 
if($this->config['fr_cr_txsh']) {
	echo 
	'<table width="100%" style="table-layout:fixed;">
		<tr><td height="15"></td></tr>
		<tr><td style="vertical-align:top;" align="center">'.$this->config['fr_cr_txa'].$this->config['fr_cr_txb'].'</td></tr>
	</table>';
}	
?>
</div>


